/*
    created: 2023/4/9
    filename: Mainmalloc.c
    author: 李东霖 
    purpose: 线性表通过动态分配内存实现的测试

*/

#include"linerBymalloc.h"
int main()
{
    SeqList list;
    InitList(&list);
    for(int i = 0; i!= 5;++i)
    InsertList(&list,1,&i);
    for(int i = 0; i!= 5;++i)
    Push_back(&list,&i);
    DispList(&list);
    printf("\n");
    int elem = 12000;
    InsertList(&list,7,&elem);
    DispList(&list);
    printf("\n");
    for(int i = 1; i!= 5;++i)
    DeleteElem(&list,i);
    DispList(&list);
    printf("\n");   
    PopFront(&list);
    printf("len =%d\n",ListLength(&list));
    DispList(&list);
    printf("\n");   
    PopBack(&list);
    printf("len =%d\n",ListLength(&list));
    DispList(&list);
    printf("\n");
    PopFront(&list);
    DispList(&list);
    elem = 1;
    printf("\npos =  %d",LocateElem(&list,&elem));
    ClearList(&list);
    DispList(&list);
    DestroyList(&list);
    if(0 == list.length) printf("他已经空了\n");
    return 0;
}